<?php
/**
接口基础模块，包含接收和输出
 */

header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: *");
header('Access-Control-Allow-Headers:*');
header('Content-Type:application/json');




function output($msg="",$code=0,$data=array()){
    $array = array(
        "msg" => $msg,
        "code" => $code,
        "data" => $data
    );
    return json_encode($array);
}



//接收post过来的json数据
function input_post(){
    $post = file_get_contents('php://input');
    return json_decode($post,true);
}